package com.chb.controller;

import com.chb.annotation.LogAnnotation;
import com.chb.model.entity.BranchGoods;
import com.chb.model.vo.Result;
import com.chb.service.InLibrayService;
import lombok.Builder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: 陈海彬
 * @date: Created in 2023/9/26 15:08
 * @description:
 * @modified By:
 * @version:
 */
@RestController
@RequestMapping("/inlibray")
public class InLibrayController {
    @Autowired
    private InLibrayService inLibrayService;

    /**
     * @param page     当前页数
     * @param pageSize 每页展示数量
     * @param branchid 模糊查询的分店id
     * @return com.chb.model.vo.Result
     * @create by: 陈海彬
     * @description: 获取所有入库信息
     * @create time: 2023/9/26 15:10
     */
    @GetMapping("/allInfo")
    @LogAnnotation(business_type = "获取所有入库信息")
    public Result getAllInfo(Integer page, Integer pageSize, Integer branchid) {
        Result inLibrayInfo = inLibrayService.getAllInLibrayInfo(page, pageSize, branchid);
        return inLibrayInfo;
    }

    /**
     * @param branchGoodsList 门店商品信息列表--通过审核
     * @create by: 陈海彬
     * @description: 添加入库信息
     * @create time: 2023/9/27 11:06
     */
    @PostMapping("/addInlibray")
    @LogAnnotation(business_type = "门店商品信息列表--通过审核")
    public Result addInlibray(@RequestBody List<BranchGoods> branchGoodsList) {
        Result result = inLibrayService.addInlibray(branchGoodsList);
        return result;
    }

    /**
     * @param id           审核id
     * @param rejectedText 驳回信息
     * @return com.chb.model.vo.Result
     * @create by: 陈海彬
     * @description: 审核驳回
     * @create time: 2023/9/27 19:01
     */
    @PostMapping("/reviewRejected")
    @LogAnnotation(business_type = "出库审核-驳回审核")
    public Result reviewRejected(Integer id, String rejectedText) {
        return inLibrayService.reviewRejected(id, rejectedText);
    }
}